package com.hongkzh.www.look.media.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hongkzh.www.R;
import com.hongkzh.www.view.activity.BaseActivity;
import com.hongkzh.www.view.customview.SeekBarPressure;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by as on 2018/4/16.
 * 征婚交友筛选页面
 */

public class FriendSelectedActivity extends BaseActivity implements View.OnClickListener {


    @BindView(R.id.tv_male)
    TextView tvMale;
    @BindView(R.id.tv_female)
    TextView tvFemale;
    @BindView(R.id.tv_tongzhi)
    TextView tvTongzhi;
    @BindView(R.id.tv_lala)
    TextView tvLala;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_age)
    TextView tvAge;
    @BindView(R.id.seekBar)
    SeekBarPressure seekBar;
    @BindView(R.id.tv_low)
    TextView tvLow;
    @BindView(R.id.tv_high)
    TextView tvHigh;
    @BindView(R.id.layout_selectArea)
    RelativeLayout layoutSelectArea;

    private final int REQUESTCODRFORCITY=3;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
//        setContentView(R.layout.activity_select_friend);
        setTranslucent(R.color.color_D8D8D8);
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_select_friend;
    }

    @Override
    protected void init() {

        mTiManager.setTitle("筛选");
        mTiManager.setLeftIcon(R.mipmap.arrow_left);
        mTiManager.setRightText("重置");

        tvAge = (TextView) findViewById(R.id.tv_age);
        seekBar = (SeekBarPressure) findViewById(R.id.seekBar);
        seekBar.setOnSeekBarChangeListener(new SeekBarPressure.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBarPressure seekBar, double progressLow, double progressHigh) {
                tvAge.setText("年龄：" + progressLow + "---" + progressHigh);
                tvLow.setText(progressLow + "");
                tvHigh.setText(progressHigh + "");
            }
        });

    }


    @Override
    protected void setListener() {
        mTiManager.getTitleLeft().setOnClickListener(this);
        layoutSelectArea.setOnClickListener(this);

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.Btn_titleLeft:
                this.finish();
                break;
            case R.id.layout_selectArea:
                // 选择城市的筛选
                Intent intent=new Intent(FriendSelectedActivity.this,CitySelectActivity.class);
                startActivityForResult(intent,REQUESTCODRFORCITY);
                break;
        }


    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        String city="";
        if(requestCode==REQUESTCODRFORCITY){
            if(resultCode==RESULT_OK){
                city=data.getStringExtra("areaName");
                tvAddress.setText(city);
            }
        }
    }

    @Override
    public void onError(Exception e) {

    }

}
